package assignment

import org.springframework.cloud.contract.spec.Contract

Contract.make {
    request {
        method 'PUT'
        url value(consumer("api/v2/assignments/\\d+"),
                producer("api/v2/assignments/1"))
        headers {
            contentType(applicationJsonUtf8())
            header('id', 21)
        }
        body("""{
                "type":"BASIC_QUIZ",
                "title":"new title"
                }
        """)
        bodyMatchers {
            jsonPath('$.type',byRegex(nonEmpty()))
            jsonPath('$.title',byRegex(nonEmpty()))
        }
    }
    response {
        status 204
    }
}